package com.jingbit.ai.dbase;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.BaseColumns;

import com.jingbit.ai.helper.Logger;


public class DBSqliteHelper extends SQLiteOpenHelper {

    public static final class UserColumns implements BaseColumns {
        public static final String USER_ID = "userId";
        public static final String USER_NAME = "userName";
        public static final String USER_PWD = "userPwd";
        public static final String USER_HEAD = "userHead";
        public static final String LAST_MODIFIED = "lastModified";
    }

    private static final String T_USERS = "CREATE TABLE IF NOT EXISTS USERS(" +
            "userId int PRIMARY KEY," +
            "userName text," +
            "userHead text," +
            "userPwd text," +
            "lastModified text" +
            ");";

    public DBSqliteHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Logger.log(this, "onCreate", db);
        db.execSQL(T_USERS);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}
